#!/usr/bin/env python

#求完数

def perfectNum(num):
    sum = 0

    for i in range(1, num // 2 + 1):
        if num % i == 0:
            sum += i

    if sum == num:
        print(num)
        return True

    return False

def countPerfectNum(num):
    sum = 0
    for i in range(1, num+1):
        if perfectNum(i):
            sum += 1
    return sum

print(countPerfectNum(int(input("请输入数字："))))


